//
//  LGInspectChartItemCell.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2023/7/19.
//

#import "LGInspectChartItemCell.h"

@interface LGInspectChartItemCell()

/**   */
@property (nonatomic , strong)UIButton *titleBtn;

@end

@implementation LGInspectChartItemCell

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self.contentView addSubview:self.titleBtn];
        [self.titleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.centerY.equalTo(self.contentView);
            make.height.equalTo(@(viewPix(26)));
        }];
    }
    return self;
}

-(void)setDataDic:(NSDictionary *)dataDic{
    _dataDic = dataDic;
    [self.titleBtn setTitle:LGNSString(dataDic[@"title"]) forState:UIControlStateNormal];
}

-(void)setIsSelected:(BOOL)isSelected{
    _isSelected = isSelected;
    self.titleBtn.selected = isSelected;
    UIFont *font = (isSelected == YES)?LGFontWeight(12, UIFontWeightMedium):LGFont(12);
    self.titleBtn.titleLabel.font = font;
}

-(UIButton *)titleBtn{
    if(!_titleBtn){
        _titleBtn = [UIButton buttonWithTitle:@"" titleFont:LGFont(12) normalColor:@"#999999" selectColor:@"#2E9AFC"];
        [_titleBtn setBackgroundColor:[UIColor colorWithString:@"#EFEFEF"] forState:UIControlStateNormal];
        [_titleBtn setBackgroundColor:[UIColor colorWithString:@"#EAF4FF"] forState:UIControlStateSelected];
        _titleBtn.userInteractionEnabled = NO;
        _titleBtn.cornerRidus = viewPix(13);
    }
    return _titleBtn;
}

@end
